package com.vidmt.api.modules.sys.utils;

import java.util.List;

import com.google.common.collect.Lists;
import com.thinkgem.jeesite.common.utils.SpringContextHolder;
import com.vidmt.api.modules.sys.service.PropertyService;

public class PropUtil {
	private static PropertyService propService = SpringContextHolder.getBean(PropertyService.class);

	public static final String KEY_SYS_ENCRYPT_KEY="sys.encrypt_key";
	//D:/GREEN/nginx-1.9.0/html/telephone
	public static final String KEY_SYS_USER_FILE_DIR="sys.user_file_dir";
	public static final String KEY_SYS_PAY_NOTIFY_URL="sys.pay_notify_url";
	public static final String KEY_SYS_USER_FILE_URL_PREFIX="sys.user_file_url_prefix";
	
	public static final String VAR_PAYTYPE="{paytype}";
	public static final String VAR_UID = "{uid}";

	public static String get(String key) {
		return propService.getValue(key);
	}

	public static void addListener(OnPropChangeListener listener) {
		listeners.add(listener);
	}

	public static void removeListener(OnPropChangeListener listener) {
		listeners.remove(listener);
	}

	private static List<OnPropChangeListener> listeners = Lists.newArrayList();

	public static interface OnPropChangeListener {
		public void onPropChange(String key, Object newVal, Object oldVal);
	}
}
